﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using Ultimus.WFServer;

namespace H2.NET
{
    public class TaskStore
    {
        #region 变量 Private
        private SortedList<string, Object> _SortedList = new SortedList<string, Object>();
        #endregion

        #region 构造 TaskAPI(函数)
        /// <summary>
        /// 
        /// </summary>
        public TaskStore()
        {        
        
        }
        #endregion

        #region 索引 取得变量
        public object this[string key]
        {
            get
            {
                if (!_SortedList.ContainsKey(key))
                {
                    return null;
                }

                return _SortedList.Values[_SortedList.IndexOfKey(key)];
            }
            set
            {
                if (!_SortedList.ContainsKey(key))
                {
                    _SortedList.Add(key, value);
                }
                else
                {
                    _SortedList[key] = value;
                }
            }
        }

        #endregion

        #region 方法 清空存储项
        public void ClearKey(string key)
        {
            for (int i = 0; i < _SortedList.Count; i++)
            {
                if (_SortedList.Keys[i].Contains(key))
                {
                    _SortedList.RemoveAt(i);
                    i--;
                }
            }
        }
        #endregion
    }
}
